<?php
/**
 * Created by PhpStorm.
 * User: hengsu
 * Date: 2016/5/23
 * Time: 18:09
 */

namespace Home\Controller;
use Think\Controller;

class OtherController extends Controller{
    public function guideList(){
        $catId=isset($_POST['catId'])?trim($_POST['catId']):0;    //分类ID
        $model=M('Guid');
        $guidList=$model->field('id,title,date')->where('cata_two='.$catId)->limit(5)->order('date DESC')->select();
        if(empty($guidList)){
            $requset=array('returnCode'=>999,'returnMsg'=>'空数据','returnData'=>null);
        }else{
            $requset=array('returnCode'=>0,'returnMsg'=>'返回成功','returnData'=>$guidList);
        }
        echo json_encode($requset); exit;
    }
    public function guideInfo(){
        $guidId=isset($_POST['guidId'])?trim($_POST['guidId']):0;    //指南ID
        $model=M('Guid');
        $guidLi=$model->where('id='.$guidId)->select();
        if(empty($guidLi)){
            $requset=array('returnCode'=>999,'returnMsg'=>'空数据','returnData'=>null);
        }else{
            $requset=array('returnCode'=>0,'returnMsg'=>'返回成功','returnData'=>$guidLi);
        }
        echo json_encode($requset); exit;
    }
}